//
//  WelcomeViewController.m
//  SoutheastAsia
//
//  Created by mEnder on 16/1/19.
//  Copyright © 2016年 zlj. All rights reserved.
//

#import "WelcomeViewController.h"

@interface WelcomeViewController ()

@property (nonatomic, strong) UIImageView *launchImage;
@property (nonatomic, strong) UIImageView *logoImage;
@property (nonatomic, strong) UILabel *versionLabel;

@end

@implementation WelcomeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view addSubview:self.launchImage];
    [self updateLanunchImage];
}
#pragma mark - private method
- (void)updateLanunchImage
{
    [self.view addSubview:self.logoImage];
    [self.view addSubview:self.versionLabel];
    [UIView animateWithDuration:4 animations:^{
        self.launchImage.transform = CGAffineTransformMakeScale(1.6,1.6);
    } completion:^(BOOL finished) {
        [self.view removeFromSuperview];
    }];

}
#pragma mark - getter
- (UIImageView *)launchImage
{
    if (!_launchImage) {
        _launchImage = [[UIImageView alloc]initWithFrame:self.view.bounds];
        _launchImage.image = [UIImage imageNamed:@"backgroundImage001.png"];
    }
    return _launchImage;
}

- (UIImageView *)logoImage
{
    if (!_logoImage) {
        _logoImage = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"logoImage.png"]];
        _logoImage.bounds = CGRectMake(0, 0, 400, 100);
        _logoImage.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMinY(self.view.bounds) + 200);
    }
    return _logoImage;
}

- (UILabel *)versionLabel
{
    if (!_versionLabel) {
        _versionLabel = [[UILabel alloc]init];
        _versionLabel.bounds = CGRectMake(0, 0, 100, 30);
        _versionLabel.center = CGPointMake(CGRectGetMidX(self.view.bounds), CGRectGetMaxY(self.view.bounds) - 60);
        _versionLabel.textAlignment = NSTextAlignmentCenter;
        _versionLabel.textColor = [UIColor whiteColor];
        _versionLabel.text = @"v 1.0.0";
    }
    return _versionLabel;
}
@end
